package com.software.cool.enums;

/**
 * 年级编号枚举
 *
 * @author admin
 * @date 2023/4/11 上午11:29
 */
public enum GradeCodeEnum implements CommonEnum {


    GRADE_ENUM_11("11","一年级"),
    GRADE_ENUM_12("12","二年级"),
    GRADE_ENUM_13("13","三年级"),
    GRADE_ENUM_14("14","四年级"),
    GRADE_ENUM_15("15","五年级"),
    GRADE_ENUM_16("16","六年级"),

    GRADE_ENUM_21("21","初一"),
    GRADE_ENUM_22("22","初二"),
    GRADE_ENUM_23("23","初三"),

    GRADE_ENUM_31("31","高一"),
    GRADE_ENUM_32("32","高二"),
    GRADE_ENUM_33("33","高三"),

    GRADE_ENUM_41("41","大一"),
    GRADE_ENUM_42("42","大二"),
    GRADE_ENUM_43("43","大三"),
    GRADE_ENUM_44("44","大四"),
    ;

    private String code;
    private String msg;


    @Override
    public String getCode() {
        return this.code;
    }
    @Override
    public String getMsg() {
        return this.msg;
    }

    GradeCodeEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    /**
     * 根据年级名称获取年级编号
     * @param gradeName
     * @return
     */
    public static String getGradeCodeByGradeName(String gradeName)
    {
        String result="";
        for (GradeCodeEnum c : GradeCodeEnum.values()) {
            if(gradeName.equals(c.getMsg()))
            {
                result=c.getCode();
                break;
            }
        }
        return result;
    }

    /**
     * 根据年级名称获取年级编号
     * @param gradeCode
     * @return
     */
    public static String getNameByCode(String gradeCode)
    {
        String result="";
        for (GradeCodeEnum c : GradeCodeEnum.values()) {
            if(gradeCode.equals(c.getCode()))
            {
                result=c.getMsg();
                break;
            }
        }
        return result;
    }

    public static void main(String[] args) {
        System.out.println(GradeCodeEnum.getNameByCode("11"));
    }
}
